{% extends "layout.html" %}

{% block title %}Lancement facture{% endblock %}

{% block content %}
<!-- script pour modif odre affichage -->
<script type="text/javascript"> if (window.jQuery == undefined) document.write( unescape('%3Cscript src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"%3E%3C/script%3E') );</script>
<script type="text/javascript" src="js/vendor/jquery.tablesorter.min.js"></script>
<script>
	$(function(){
  $("#myTable").tablesorter();
});
</script>

{% if not(session.niveauAuth=='2')and not(session.niveauAuth=='5')and not(session.niveauAuth=='6')and not(session.niveauAuth=='9') %}
     <div class="span5">
	
	  <fieldset>
	  
		<legend>Facturation fixe vga + voip</legend>

	  <div class="control-group">
		<input type=button value="Lancement "  onclick="self.location.href='facturation-fixe';" />
		
		  
		</div>
	  </div>
       {% endif %}
      
      
      </fieldset>
     
       
      
      <div class="span6">
        {% if not(session.niveauAuth=='3')and not(session.niveauAuth=='6')and not(session.niveauAuth=='9') %}
      <fieldset>
	<legend>Facturation Mobile

	</legend>
	<div class="control-group">
		<div class="control-group">
<input type=button value="Lancement "  onclick="self.location.href='facturation-mobile';" />
      
	  </div>  
      </div>
	 {% endif %}
      
      </fieldset>
      
      </div>
      <!-- Deuxième colonne -->
      {% if not(session.niveauAuth=='6')and not(session.niveauAuth=='9') %}
  <div class="span5">
	<fieldset>
	<legend>Envoie facture par mail </legend>
	 <form method=post id="mail" action="envoie-mail">
			<!--<input id=code type=text placeholder="facture/mois en cours"name=code size=10/>  -->
		<input type=submit value="Envoyer"/>
			
		

			
		
        </fieldset>	
		 </div>
         
 <div class="span5">        
              <legend>Génération du fichier bancaire</legend>

	<fieldset>
	
<input type="button" value="valider"  onclick="self.location.href='inc/SEPA/index.php';"/>

  </fieldset>	
		 </div>
       {% endif %}   
<div class="row">
	
	 <!-- tROISIEME colonne -->
 <div class="span11">
	<br /></br>
	  <fieldset>
		<legend>Récapitulatif facturations</legend>

	 
			  <table class="table table-striped tablesorter" id="myTable">
	   <thead>
	  <tr>
	  <th>Nom prenom / Raison sociale{{session.niveauAuth}}</th>
      <th>Type </th>
	  <th>Montant € HT</th>
      <th>Montant € TTC</th>
	  <th>Date</th>
	  <th>Facture</th>
      <th>Envoi</th>
	  </tr>
	  </thead>
	 {% for facture in factures %}
         {% if session.niveauAuth=='1' or session.niveauAuth=='3' or session.niveauAuth=='5' %}
            <tr>
            <td>{{facture.nom}}{% if facture.type == 'ponctuelle'%} <a href="detail-facture-ponctuelle?id-facture={{ facture.id }}"><small>Détail</small></a>{% endif %}</td>
            <td>{{facture.type}}</td>
            <td align="right">{{facture.total_facturation|number_format(2,',', ' ')}}</td>
            <td align="right">{{(facture.total_facturation*1.2) | number_format(2,',', ' ')}}</td>
            <td>{{facture.date|date("d/m/Y")}}</td>
            <td>{% if not facture.facture is empty %}<a href="{{facture.facture}}" target="_blank"><img src="img/pdf-logo.jpg" width="25px" /></a>{% endif %}</td>
            <td> {% if facture.facture_envoi == 'ok' %}<img src="img/ok.jpg" width="25px" />{% endif %}</td>
            </tr>
          {% elseif facture.facture_envoi == 'ok' and (session.niveauAuth!='1' or session.niveauAuth!='5') %}
            <tr>
            <td>{{facture.nom}}</td>
            <td>{{facture.type}} </td>
            <td align="right">{{facture.total_facturation|number_format(2,',', ' ')}}</td>
            <td align="right">{{(facture.total_facturation*1.2) | number_format(2,',', ' ')}}</td>
            <td>{{facture.date|date("d/m/Y")}}</td>
            <td><a href="{{facture.facture}}" target="_blank"><img src="img/pdf-logo.jpg" width="25px" /></a></td>
            <td> {% if facture.facture_envoi == 'ok' %}<img src="img/ok.jpg" width="25px" />{% endif %}</td>
            </tr>  
		{% endif %}
    {% endfor %}						
	  </table>
	  
      <h4><center>
      {% if not(session.niveauAuth=='3') %}
      Total facturation mobile: {{total_mobile_ttc}} € TTC ({{total_mobile}} € HT)   - 
      {% endif %}
      {% if not(session.niveauAuth=='2' or session.niveauAuth=='5' or session.niveauAuth=='6' or session.niveauAuth=='9') %}
       Total facturation fixe: {{total_fixe_ttc}} € TTC ({{total_fixe}} € HT)</center></h4>
        {% endif %}
    </fieldset>
    </div>
    </div>
   
    

{% endblock %}
	
